package com.gscitysfy.cus.drain.modules.resource.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gscitysfy.cloudfrmwk.assistant.domain.Result;
import com.gscitysfy.cus.drain.modules.resource.dto.MnWarehouseRequest;
import com.gscitysfy.cus.drain.modules.resource.entity.DrainBaseMnWarehouse;
import com.gscitysfy.cus.drain.modules.resource.service.IDrainBaseMnWarehouseService;
import com.gscitysfy.cus.drain.modules.warning.entity.DrainSignal;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 物资仓库表 前端控制器
 * </p>
 *
 * @author user
 * @since 2022-10-24 16:57:08
 */
@Tag(name = "资源管理 -> 物资仓库")
@AllArgsConstructor
@RestController
@RequestMapping("/resource/drain-base-mn-warehouse")
public class DrainBaseMnWarehouseController {

    @Resource
    private IDrainBaseMnWarehouseService drainBaseMnWarehouseService;
    @Operation(summary = "物资仓库列表")
    @GetMapping("/page")
    public Result<Object> page(@Parameter(hidden = true) Page<DrainBaseMnWarehouse> page, @Parameter(hidden = true) DrainBaseMnWarehouse drainBaseMnWarehouse){
        return drainBaseMnWarehouseService.getByPage(page, drainBaseMnWarehouse);
    }


    @Operation(summary = "物资仓库列表")
    @GetMapping("/pages")
    public Result<Object> pages(@Parameter(hidden = true) Page<DrainBaseMnWarehouse> page, @Parameter(hidden = true) MnWarehouseRequest request){
        return drainBaseMnWarehouseService.getByPages(page, request);
    }

    @Operation(summary = "物资仓库列表")
    @GetMapping("/export")
    public void export(@RequestParam(value = "goodsName",required = false) String goodsName, @RequestParam("ids") List<String> ids, HttpServletResponse response){
       drainBaseMnWarehouseService.export(goodsName, ids,response);
    }

    @Operation(summary = "新增物资仓库")
    @PostMapping
    public Result<Boolean> save(@RequestBody DrainBaseMnWarehouse drainBaseMnWarehouse) {
        /*return Result.content(drainBaseMnWarehouseService.saveDrainBaseMnWarehouse(drainBaseMnWarehouse));*/
        return  null;
    }
    @Operation(summary = "删除物资仓库")
    @PostMapping(value = "/delete/{id}")
    public Result delete(@PathVariable Long id) {
        return drainBaseMnWarehouseService.delete(id);
    }



}
